package com.zzzzzz.topic.dao;

import org.bson.types.ObjectId;
import org.springframework.stereotype.Repository;

import com.zzzzzz.core.dao.morphia.BaseDao;
import com.zzzzzz.topic.model.Category;

@Repository
public class CategoryDao extends BaseDao {

	public void add(Category category){
		datastore.save(category);
	}
	
	public Category findById(String id) {
		return datastore.find(Category.class, "_id", ObjectId.massageToObjectId(id)).get();
	}

	public Category findByLb(String lb) {
		return datastore.find(Category.class, "lb", lb).get();
	}
	
}
